package yh.aop.demo.service.impl;

import com.github.benmanes.caffeine.cache.Cache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import yh.aop.demo.Annotation.DoubleCache;
import yh.aop.demo.mapper.EstimatedArrivalDateMapper;
import yh.aop.demo.model.EstimatedArrivalDateEntity;
import yh.aop.demo.service.DoubleCacheService;

import javax.annotation.Resource;

/**
 * @author yangheng
 * @version 1.0
 * @date 2024/7/14 16:46
 */
@Service
@Slf4j
public class DoubleCacheServiceImpl implements DoubleCacheService {


    @Resource
    private Cache<String, Object> caffeineCache;

    @Resource
    private RedisTemplate<String, Object> redisTemplate;

    @Resource
    private EstimatedArrivalDateMapper estimatedArrivalDateMapper;

    @DoubleCache(cacheName = "estimatedArrivalDate", key = {"#request.deliveryDate", "#request.warehouseId", "#request.city"},
            type = DoubleCache.CacheType.FULL)
    @Override
    public EstimatedArrivalDateEntity getEstimatedArrivalDateCommon(EstimatedArrivalDateEntity request) {
        return null;
    }

    @Override
    public EstimatedArrivalDateEntity getEstimatedArrivalDate(EstimatedArrivalDateEntity request) {
        return null;
    }
}
